package br.org.espmessenger.servidor;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import br.org.espmessenger.middleware.ESPMessenger;
import br.org.espmessenger.middleware.ESPMessengerImpl;

public class Servidor {

	public static void main(String[] args) {
		try {
			ESPMessenger esp = new ESPMessengerImpl(); 
			LocateRegistry.createRegistry(1099);
			Naming.rebind("rmi://localhost:1099/ESPMessenger2", esp);
			System.out.println("Servidor levantado");
			System.out.println("À espera de conexões");
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}

		
	}
}
